Dividing values in Report
Alex_de_Kock
Bloemfontein, Free State, South Africa
Hallo
I am not a expert in programming, so please excuse me if i'm asking dumb questions! :-)
I need some assistance with diving 2 values from my database, to get the desired value, but it gives me the following error:
"Invalid floating point operation".
My current expression looks as follows
[<SalesSummary."stk_on_hand">/<SalesSummary."NettSales">]
Please help
Thank you
I am not a expert in programming, so please excuse me if i'm asking dumb questions! :-)
I need some assistance with diving 2 values from my database, to get the desired value, but it gives me the following error:
"Invalid floating point operation".
My current expression looks as follows
[<SalesSummary."stk_on_hand">/<SalesSummary."NettSales">]
Please help
Thank you
Comments
[((<SalesSummary."stk_on_hand">) / (<SalesSummary."NettSales">))]
Its still giving the same error. When I replace the divide "/" with "+" or"-", it works fine.
Any advice?
In my example you'll find both ways - a calculated field and an expression inside a MemoView.
Both with succes
Mick
I sorted the query as follows:
IIF(<SalesSummary."DEPT_CODE"> = '01',(<SalesSummary."stk_on_hand">/<SalesSummary."nettsales">)*4.33,0)
I Think as the error said "Floating point", it was trying to calculate over and over for my 20 different stock departments, as I didn't specify which department to draw information from.
Thus setting the Department as a constant, the query could resolve.
Thank you very much [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> Alex[/img]
When the MemoView is on a band then its inside calculation is made just once for each apperance of the band.
You can prove it by setting where clause
where DEPT_CODE = '01'
in your former solutiuon without IIF function.
Try to test new another solution using OnBeforePrint event for this MemoView, like below:
Contents of MemoView [MyVariable]
Mick
I will look into that, as I'm not so comfortable with writing code yet - have very limited knowledge of it.
Meanwhile sorted it out with that iff statement and repeating it in the Memo view for each department.
Alex
and put text [MyNumber] inside Memo1 (alltogether with square brackets).
Good luck [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Mick[/img]